const dayjs = require('dayjs')

module.exports = {
  getDateOptions(scope = 'day', date = dayjs().format('YYYY-MM-DD')) {
    const label = {
      day: '天',
      week: '周',
      month: '月',
    }[scope]

    const startTime = dayjs(date).startOf(scope).format('YYYY-MM-DD 00:00:00')
    const endTime = dayjs(date).endOf(scope).format('YYYY-MM-DD 23:59:59')

    return {
      startTime,
      endTime,
      scope,
      label,
    }
  },
}
